Jes.Index = {
	top : function(){
		Jes.html('center','<iframe frameborder="0" width="100%" id="main" scrolling="no" allowtransparency="true"></iframe>');
		window.setInterval("Jes.reIframe('main')", 1000);
		var act = Jes.request("act");
		if(act != null){
			Jes.iframe(act+".html?"+window.location.search.substr(6+act.length));
		}else{
			this.ad();
			//Jes.sql({isSess:0,isLoad:false,ids:'1',sql:"vcount_update_hql@bs"},function(da){});
			Jes.save('TJesPv',{isSess:0,isLoad:0},0);
			Jes.iframe('center.html');//默认
		}
		this.link();
		this.queryPv();
	}
	,queryPv : function(){
		Jes.action('listPv@App',function(da){
			Jes.each(da,function(i){
				Jes.html('pv_'+i,da[i]['num']);
			})
		});
	}
	,ad : function(){
		Jes.query('flowimg_query_sql@bl',{isSess:0,isLoad:false},function(da){
			if(Jes.isNull(da)) return;
			da = da[0];
			Jes.html('ad_img','<a target="_blank" href="'+da.url+'"><img src="'+DA.imgpath+da.img+'" border="0" width="'+da.width+'" height="'+da.height+'" alt="'+da.name+'"></a>');
			Jes.Ad.init(da);
		});
		Jes.query('couplet_query_sql@bl',{isSess:0,isLoad:false},function(da){
			if(Jes.isNull(da)) return;
			da = da[0];
			//对联
			Jes.Flt.item('fdiv1','10',2,'<br><a href="'+da.lefturl+'" target=_blank><img src="'+DA.imgpath+da.leftimg+'" alt="'+da.leftname+'" border="0"></a><br><img src="../themes/default/images/close.gif" border="0" style="cursor:pointer" onclick="javascript:Jes.hide(\'fdiv1\');">');
			Jes.Flt.item('fdiv2','document.body.clientWidth-106',2,'<br><a href="'+da.lefturl+'" target=_blank><img src="'+DA.imgpath+da.leftimg+'" alt="'+da.leftname+'" border="0"></a><br><img src="../themes/default/images/close.gif" border="0" style="cursor:pointer" onclick="javascript:Jes.hide(\'fdiv2\');">');
			Jes.Flt.play();
		});
	}
	,init : function(){
		this.notice('3');//公告
		this.imgNews('4');//要闻
		this.listAll('list_4',4,7,32);//要闻
		this.list('list_8',8,6,66);//国检
		this.fwdt('5');//服务
		this.ztzl('7');//专题
		this.wsbs('11');//办事
		this.imgShows('12');//图片展示
		this.video();
	}
	,notice : function(menuid){
		var taEl=Jes('notice'),tr,td;
		Jes.page('topic_query_sql@bl',{isSess:0,isLoad:0,size:8,param:{menuid:menuid,isdue:1}},function(da){
			da =da.list;
			Jes.each(da,function(i){
				tr = Jes.Table.newTr(taEl);
				td = Jes.Table.newTd(tr,{vAlign:'top'},null,'<img vspace="8" src="../themes/default/images/flag9.gif">');
				td = Jes.Table.newTd(tr,null,null,'<a style="line-height:200%" title="'+da[i].title+'" href="index.html?act=infoshow&menuid='+da[i].fmenuid+'&infoid='+da[i].id+'" target="_blank">'+da[i].title.sub(50,1)+'</a> <font class="fontCCCCCC">'+da[i].posttime.substr(0,10)+'</font>');
				//td = Jes.Table.newTd(tr,{align:'right',width:'32px'},null,'<font class="fontCCCCCC">'+da[i].posttime.substr(5)+'</font>');
			});
			//initMarquees();
		});
	}
	,imgNews : function(menuid){
		var pics='',links='',texts='',p,focus_width = 220,focus_height = 170,text_height = 20,swf_height = focus_height + text_height;
		Jes.action('getMenuIdsByPId@App',menuid,function(menuids){
			Jes.page('topic_query_sql@bl',{isSess:0,isLoad:0,size:5,param:{menuids:menuids,isimg:'1'}},function(da){
				da = da.list;
				Jes.each(da,function(i){
					p =(i==0)?'':'|';
					pics += p+DA.imgpath+da[i].img;
					links +=p+escape('index.html?act=infoshow&menuid='+da[i].fmenuid+'&infoid='+da[i].id);
					texts +=p+da[i].title.sub(30,1);
				});
				var html =[];
				html.push('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + focus_width + '" height="' + swf_height + '">');
				html.push('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="../themes/default/images/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#FFF4F0">');
				html.push('<param name="menu" value="false"><param name=wmode value="opaque">');
				html.push('<param name="FlashVars" value="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '">');
				html.push('<embed src="../themes/default/images/pixviewer.swf" wmode="opaque" FlashVars="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '" menu="false" bgcolor="#ffffff" quality="high" width="' + focus_width + '" height="' + swf_height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
				html.push('</object>');
				Jes.html('imgnews',html);
			});
		});
		//var pics = 'newsimg/newsimg19_1.jpg|newsimg/newsimg18_1.jpg|newsimg/newsimg17_1.jpg|newsimg/newsimg16_1.jpg|newsimg/newsimg15_1.jpg';
		//var links = 'info_show.asp?sysid=19|info_show.asp?sysid=18|info_show.asp?sysid=17|info_show.asp?sysid=16|info_show.asp?sysid=15';
		//var texts = '政策预警测试-局领导赴各现场工作...|情况通报测试-局领导赴各现场工作...|国检动态测试-局领导赴各现场工作...|服务外贸测试-局领导赴各现场工作...|把关查验测试-局领导赴各现场工作...'
	}
	,imgShows : function(menuid){
		var html =[];
		Jes.page('topic_query_sql@bl',{isSess:0,isLoad:0,size:14,param:{menuid:menuid}},function(da){
			da = da.list;
			Jes.each(da,function(i){
				if(i==0) html.push('<li>');
				if(i!=0 && i%7==0) html.push('</li><li>');
				html.push('<p align="center"><a href="index.html?act=infoshow&menuid='+da[i].fmenuid+'&infoid='+da[i].id+'" target="_blank"><img alt="" width="120" height="90" hspace="2" vspace="2" src="'+DA.imgpath+da[i].img+'"><br>'+da[i].title.sub(16,1)+'<span></span></a></p>');
			});
			html.push('</li>');
			Jes.html('pics',html);
			(function(){
				var vari={
					width:960,
					pics:document.getElementById("pics"),
					prev:document.getElementById("prev"),
					next:document.getElementById("next"),
					len:document.getElementById("pics").getElementsByTagName("li").length,
					intro:document.getElementById("pics").getElementsByTagName("p"),
					now:1,
					step:5,
					dir:null,
					span:null,
					span2:null,
					begin:null,
					begin2:null,
					end2:null,
					move:function(){
						if(parseInt(vari.pics.style.left,10)>vari.dir*vari.now*vari.width&&vari.dir==-1){
							vari.step=(vari.step<2)?1:(parseInt(vari.pics.style.left,10)-vari.dir*vari.now*vari.width)/5;
							vari.pics.style.left=parseInt(vari.pics.style.left,10)+vari.dir*vari.step+"px";
						}
						else if(parseInt(vari.pics.style.left,10)<-vari.dir*(vari.now-2)*vari.width&&vari.dir==1){
							vari.step=(vari.step<2)?1:(-vari.dir*(vari.now-2)*vari.width-parseInt(vari.pics.style.left,10))/5;
							vari.pics.style.left=parseInt(vari.pics.style.left,10)+vari.dir*vari.step+"px";
						}
						else{
							vari.now=vari.now-vari.dir;
							clearInterval(vari.begin);
							vari.begin=null;
							vari.step=5;
							vari.width=960;
						}
					},
					scr:function(){
						if(parseInt(vari.span.style.top,10)>-31){
							vari.span.style.top=parseInt(vari.span.style.top,10)-5+"px";
						}
						else{
							clearInterval(vari.begin2);
							vari.begin2=null;
						}
					},
					stp:function(){
						if(parseInt(vari.span2.style.top,10)<0){
							vari.span2.style.top=parseInt(vari.span2.style.top,10)+10+"px";
						}
						else{
							clearInterval(vari.end2);
							vari.end2=null;
						}
					}
				};
				vari.prev.onclick=function(){
					if(!vari.begin&&vari.now!=1){
						vari.dir=1;
						vari.begin=setInterval(vari.move,20);
					}
					else if(!vari.begin&&vari.now==1){
						vari.dir=-1
						vari.width*=vari.len-1;
						vari.begin=setInterval(vari.move,20);
					};
				};
				vari.next.onclick=function(){
					if(!vari.begin&&vari.now!=vari.len){
						vari.dir=-1;
						vari.begin=setInterval(vari.move,20);
					}
					else if(!vari.begin&&vari.now==vari.len){
						vari.dir=1
						vari.width*=vari.len-1;
						vari.begin=setInterval(vari.move,20);
					};
				};
				for(var i=0;i<vari.intro.length;i++){
					vari.intro[i].onmouseover=function(){
						vari.span=this.getElementsByTagName("span")[0];
						vari.span.style.top=0+"px";
						if(vari.begin2){clearInterval(vari.begin2);}
						vari.begin2=setInterval(vari.scr,20);
					};
					vari.intro[i].onmouseout=function(){
						vari.span2=this.getElementsByTagName("span")[0];
						if(vari.begin2){clearInterval(vari.begin2);}
						if(vari.end2){clearInterval(vari.end2);}
						vari.end2=setInterval(vari.stp,5);
					};
				}
			})();
		});
	}
	,listAll : function(el,menuid,size,len){
		Jes.action('getMenuIdsByPId@App',menuid,function(da){
			Jes.Index.listH(el,da,'',size,len);
		});
	}
	,list : function(el,menuid,size,len){
		Jes.Index.listH(el,'',menuid,size,len);
	}
	,listH : function(el,menuids,menuid,size,len){
		var taEl=Jes(el),tr,td,c;
		Jes.page('topic_query_sql@bl',{isSess:0,isLoad:0,size:size,param:{menuids:menuids,menuid:menuid}},function(da){
			da=da.list;
			Jes.each(da,function(i){
				c=(i%2==0)?'':'#eef9ff';
				tr = Jes.Table.newTr(taEl,{bgColor:c});
				Jes.Table.newTd(tr,{height:'28px',align:'center'},null,'<img src="../themes/default/images/flag8.gif">');
				Jes.Table.newTd(tr,null,null,'<a title="'+da[i].title+'" href="index.html?act=infoshow&menuid='+da[i].fmenuid+'&infoid='+da[i].id+'" target=_blank>'+da[i].title.sub(len,1)+'</a>');
				Jes.Table.newTd(tr,{className:'fontCCCCCC',width:'47px'},null,''+da[i].posttime.substr(0,10)+'');
			});
		});
	}
	//专题转栏
	,ztzl : function(menuid){
		Jes.action('listMenu@App',menuid,function(da){
			var taEl=Jes('ztzl_menu'),tr,img,url;
			Jes.each(da,function(i){
				if(i==3) return false;
				tr=Jes.Table.newTr(taEl);
				url = Jes.menuUrl(da[i],true)[0];
				if(da[i][2]=='1'){
					Jes.Table.newTd(tr,{height:'75px'},null,'<a href="'+url+'" target="_blank"><img alt="'+da[i][1]+'" src="'+DA.imgpath+da[i][3]+'"></a>');
				}else{
					Jes.Table.newTd(tr,{height:'25px'},null,' • <a href="'+url+'" target="_blank">'+da[i][1]+'</a>');
				}
				//Jes.Table.newTd(tr,null,null,'•<a href="'+url+'" target="_blank">'+img+'</a>');//{align:'center'}height:'75px',
			});
		});
	}
	,link : function(){
		//this.imgLink1();
		//this.flfg('2');//法律法观 13-->2
		this.imgLink2();
		Jes.Select.idxLink('link1',{type:3,isSess:0},'--出入境检验检疫局链接');
		Jes.Select.idxLink('link2',{type:5,isSess:0},'--党政机关链接');
		Jes.Select.idxLink('link3',{type:4,isSess:0},'--企业网站链接');
		Jes.Select.idxLink('link4',{type:6,isSess:0},'--常用网站链接');
	}
	//法律法观
	,flfg : function(menuid){
		var taEl=Jes('imglink1'),tr=Jes.Table.newTr(taEl),td;
		Jes.action('listMenu@App',menuid,function(da){
			Jes.each(da,function(i){
				img=da[i][2]=='1'?'<img border="0" alt="'+da[i][1]+'" src="'+DA.imgpath+da[i][3]+'">':da[i][1];
				url = Jes.menuUrl(da[i],true)[0];
				Jes.Table.newTd(tr,{width:'180',align:'center'},null,'<a href="'+url+'" target="_blank">'+img+'</a>');
			});
		});
	}
	,imgLink2 : function(){
		var taEl=Jes('imglink2'),tr=Jes.Table.newTr(taEl),td;
		Jes.query('idxlink_query_sql@sel',{isSess:0,isLoad:0,param:{type:2}},function(da){
			Jes.each(da,function(i){
				Jes.Table.newTd(tr,{align:'center'},null,'<a href="'+da[i].id+'" target="_blank"><img border="0" width="141" height="47" src="'+DA.imgpath+da[i].logo+'"></a>');
			});
		});
	}
	//右边的图片链接网上办事
	,wsbs : function(menuid){
		var taEl=Jes('wsbs_link'),tr,td,img,url;
		Jes.action('listMenu@App',menuid,function(da){
			Jes.each(da,function(i){
				tr=Jes.Table.newTr(taEl);
				img=da[i][2]=='1'?'<img alt="'+da[i][1]+'" src="'+DA.imgpath+da[i][3]+'">':da[i][1];
				url = Jes.menuUrl(da[i],true)[0];
				Jes.Table.newTd(tr,{height:'45px',vAlign:'top',align:'center'},null,'<a href="'+url+'" class="font26_000000" target="_blank">'+img+'</a>');
			});
		});
	}
	//服务大厅
	,fwdt : function(menuid){
		Jes.action('listMenu@App',menuid,function(da){
			var taEl=Jes('fwdt_menu'),tr=Jes.Table.newTr(taEl),cls,cls_a,url;
			Jes.each(da,function(i){
				if(i>4) return false;
				if(i==0){
					cls='table_td2',cls_a='table_td_a2';
					Jes.Index.fwdtMore(da[i][0]);
				}else{
					cls='table_td1',cls_a='table_td_a1';
				}
				Jes.Table.newTd(tr,{width:''});
				url = Jes.menuUrl(da[i],true)[0];
				Jes.Table.newTd(tr,{width:'',align:'center',id:'TabTitle',className:cls},null,'<a href="'+url+'" target="_blank" onMouseOver="javascript:ShowTabs(\'TabTitle\',\'Tabs\','+i+');Jes.Index.fwdtMore(\''+da[i][0]+'\')"class="'+cls_a+'">'+da[i][1]+'</a>');
			});
		});
	}
	,fwdtMore : function(menuid){
		var da = DA.FWDT['LEV_'+menuid],da1;
		if(!da){
			Jes.sync(function(){
				Jes.action('listMenuDeep@App',{menuid:menuid,getChild:'1'},function(_da){
					DA.FWDT['LEV_'+menuid]=_da;
				});
			});
		}
		da=DA.FWDT['LEV_'+menuid];
		DWRUtil.removeAllRows('Tabs');
		var taEl = Jes('Tabs'),tr,td,url,no;
		Jes.each(da,function(i){//lev1
			if(i>5) return false;//6
			tr=Jes.Table.newTr(taEl);
			url = Jes.menuUrl(da[i]['node'],true)[0];
			Jes.Table.newTd(tr,{height:'25',align:'center'},null,'<a href="'+url+'" target="_blank">'+da[i]['node'][1]+'</a>');
			da1= da[i]['childNode'];
			for(var n=0;n<3;n++){
				Jes.Table.newTd(tr,{align:'center',id:da[i]['node'][0]+'_td'+n},null,'<img src="../themes/default/images/none.jpg" width="14" height="14" border="0">');
			}
			Jes.each(da1,function(j){//lev2
				if(j>2) return false;
				url = Jes.menuUrl(da1[j],true)[0];
				no = da1[j][1]=='办事指南'?0:(da1[j][1]=='表格下载'?1:2);
				Jes.html(da[i]['node'][0]+'_td'+no,'<a href="'+Jes.sysUrl('info',{menuid:da1[j][0]})+'" target="_blank"><img src="../themes/default/images/zhinan.gif" width="14" height="14" border="0"></a>')
				//Jes.Table.newTd(tr,{align:'center'},null,'<a href="'+Jes.sysUrl('info',{menuid:da1[j][0]})+'" target="_blank"><img src="../themes/default/images/zhinan.gif" width="14" height="14" border="0"></a>');
			});
			tr=Jes.Table.newTr(taEl);
			Jes.Table.newTd(tr,{height:'1',colSpan:'4',background:'../themes/default/images/line1.jpg',align:'center'});
		});
	}
	,video : function(){
		Jes.page('topic_query_sql@bl',{isSess:0,isLoad:0,page:0,size:1,param:{istvideo:1}},function(da){
			da = da.list[0];
			if(da){
				Jes.val('video','<object type="application/x-shockwave-flash" data="vcastr3.swf" width="220" height="160" id="vcastr3">'
                +'<param name="movie" value="vcastr3.swf"/><param name="allowFullScreen" value="true" />'
                +'<param name="FlashVars" value="xml=<vcastr><channel><item><source>'+da.vurl+'</source><duration></duration><title></title></item></channel><config><isShowAbout>true</isShowAbout><isAutoPlay>false</isAutoPlay><isLoadBegin>false</isLoadBegin></config></vcastr>"/></object>');
			}
			/*
			Jes.val('video','<object id="wmplay" width="220" height="160" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'
				+'<param name="FileName" value="'+da.vurl+'"><param name="DisplaySize" value="0"><param name="autostart" value="0">'
				+'<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin" filename="'+da.vurl+'" displaysize="0" name="wmplay" width="220" height="160"></embed></object>');
			*/
			//Jes.val('video','<embed src="" width="220" height="160" autostart="no"></embed>');
		});
	}
}

function ShowTabs(title, tab, num) {
	var tabTitles = Jes.name(title),tabs = Jes.name(tab);
	Jes.each(tabTitles,function(i){
		if(num==i){
			//Jes.show(tabs[i]);
			tabTitles[i].className='table_td2';
			Jes.tag('A',tabTitles[i])[0].className='table_td_a2';
		}else{
			tabTitles[i].className='table_td1';
			Jes.tag('A',tabTitles[i])[0].className='table_td_a1';
			//Jes.hide(tabs[i]);
		}
	});

}